package com.bwie.controller;

import com.bwie.pojo.Order;
import com.bwie.pojo.ProdInfo;
import com.bwie.service.OrderService;
import com.bwie.utils.R;
import com.bwie.vo.OrderPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: tsh
 * @Date: 2025/7/23 16:46
 * @Description: TODO
 **/
@RestController
@RequestMapping("/goods/order")
@Api(tags = "订单服务")
public class OrderController {
    @Autowired
    OrderService orderService;

    /**
     * @description
     * @params
     * @param orderPageVo
     * @return com.bwie.utils.R
     * @author tsh
     * @date 2025/7/23 16:50
     */
    @PostMapping("/getOrderList")
    @ApiOperation(value = "订单列表分页")
    public R getOrderList(@RequestBody OrderPageVo orderPageVo){
        return orderService.getOrderList(orderPageVo);
    }
    @PostMapping("/deleteAllOrder")
    @ApiOperation(value = "批量删除订单")
    public R deleteAllOrder(@RequestBody List<Order> orderList){
        return orderService.deleteAllOrder(orderList);
    }

    @GetMapping("/exportOrder/{ids}")
    @ApiOperation(value = "导出订单")
    public void exportOrder(@PathVariable("ids") String ids){
         orderService.exportOrder(ids);
    }
    @PostMapping("/addOrder")
    @ApiOperation(value = "添加订单")
    public R addOrder(@RequestBody List<ProdInfo> prodInfoList){
        return  orderService.addOrder(prodInfoList);
    }
    @PostMapping("/getOrderRecordList")
    @ApiOperation(value = "订单记录列表")
    public R getOrderRecordList(){
        return  orderService.getOrderRecordList();
    }

}
